package Tools;

import Model.User;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.Random;

public class Yanzhengma {
    private Connection connection1;
    public static  ArrayList<User> users=new ArrayList<>();

    public static String code() {
        String ress = "";
        char[] str = {'1', '3', '5', '2', '7', '9', '8', '4', 'r', 'u', 'o', 'p', 'd', 'D', 'Q', 'C'};
        Random random = new Random();
        for (int i = 0; i < 4; i++) {
            int anInt = random.nextInt(16);
            ress += str[anInt];
        }
        return ress;
    }

//    public Yanzhengma() throws Exception {
//
//        Properties properties = new Properties();
//        properties.load(new FileInputStream("src/jdbc1.properties"));
//        DataSource dataSource = DruidDataSourceFactory.createDataSource(properties);
//        connection1 = dataSource.getConnection();
//        String sql = "select * from user";
//        PreparedStatement Statement = connection1.prepareStatement(sql);
//        ResultSet resultSet = Statement.executeQuery();
//        while (resultSet.next()) {
//
//            User user = new User();
//            user.setSname(resultSet.getString("sname"));
//            user.setPassword(resultSet.getInt("password"));
//
//            users.add(user);
//
//        }


//    }
}

